<?php
/**
*
* @author kmklr72 (Kevin Murek)
* @package umil
* @copyright (c) 2009 kmklr72
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/

/**
* @ignore
*/
define('UMIL_AUTO', true);
define('IN_PHPBB', true);
$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.' . $phpEx);
$user->session_begin();
$auth->acl($user->data);
$user->setup();

if (!file_exists($phpbb_root_path . 'umil/umil_auto.' . $phpEx))
{
	trigger_error('Please download the latest UMIL (Unified MOD Install Library) from: <a href="http://www.phpbb.com/mods/umil/">phpBB.com/mods/umil</a>', E_USER_ERROR);
}

$mod_name = 'SN_MOD';
$version_config_name = 'social_network';
$language_file = 'mods/social_network_install';

$versions = array(
	'0.0.1-alpha1' => array(
		'table_add' => array(
			array('phpbb_sn_blocks', array(
					'COLUMNS' => array(
						'block_id'			=> array('UINT', NULL, 'auto_increment'),
						'block_name'		=> array('VCHAR:255', ''),
						'block_pos'			=> array('CHAR:1', 'L'),
						'block_html_file'	=> array('VCHAR:255', ''),
						'block_php_file'	=> array('VCHAR:255', ''),
						'paginate_file'		=> array('VCHAR:255', ''),
					),
					'PRIMARY_KEY'	=> 'block_id',
				),
			),
			array('phpbb_user_blocks', array(
					'COLUMNS' => array(
						'user_id'		=> array('UINT', 0),
						'left_order'	=> array('VCHAR:255', ''),
						'center_order'	=> array('VCHAR:255', ''),
						'right_order'	=> array('VCHAR:255', ''),
					),
					'PRIMARY_KEY'	=> 'user_id',
				),
			),
			array('phpbb_clubs', array(
					'COLUMNS' => array(
						'club_id'		=> array('UINT', NULL, 'auto_increment'),
						'club_name'		=> array('VCHAR:255', ''),
						'club_desc'		=> array('MTEXT', ''),
						'club_email'	=> array('VCHAR:255', ''),
						'club_reason'	=> array('VCHAR:255', ''),
						'club_founder'	=> array('TINT:127', 0),
						'num_members'	=> array('INT:11', 0),
						'num_comments'	=> array('INT:11', 0),
						'creation_time'	=> array('INT:11', 0),
					),
					'PRIMARY_KEY'	=> 'club_id',
				),
			),
			array('phpbb_clubs_pending', array(
					'COLUMNS' => array(
						'club_id'		=> array('TINT:127', 0),
						'user_id'		=> array('TINT:127', 0),
						'join_reason'	=> array('MTEXT', ''),
					),
					'PRIMARY_KEY'	=> 'club_id',
					'KEY'			=> 'user_id',
				),
			),
			array('phpbb_comments', array(
					'COLUMNS' => array(
						'comment_id'		=> array('INT:11', NULL, 'auto_increment'),
						'user_id'			=> array('TINT:127', 0),
						'poster_id'			=> array('TINT:127', 0),
						'post_time'			=> array('INT:11', 0),
						'message'			=> array('MTEXT', ''),
						'bbcode_bitfield'	=> array('VCHAR:255', ''),
						'bbcode_uid'		=> array('VCHAR:8', ''),
						'bbcode_options'	=> array('VCHAR:255', ''),
						'enable_smilies'	=> array('TINT:1', 1),
						'enable_bbcode'		=> array('TINT:1', 1),
						'enable_magic_url'	=> array('TINT:1', 1),
					),
					'PRIMARY_KEY'	=> 'comment_id',
				),
			),
			array('phpbb_moods', array(
					'COLUMNS' => array(
						'mood_id'		=> array('UINT', NULL, 'auto_increment'),
						'mood_name'		=> array('VCHAR:255', ''),
						'mood_image'	=> array('VCHAR:255', ''),
					),
					'PRIMARY_KEY'	=> 'mood_id',
				),
			),
			array('phpbb_sn_config', array(
					'COLUMNS' => array(
						'sn_config_name'	=> array('VCHAR:255', ''),
						'sn_config_value'	=> array('MTEXT', ''),
					),
					'PRIMARY_KEY'	=> 'sn_config_name',
				),
			),
			array('phpbb_profile_data', array(
					'COLUMNS' => array(
						'user_id'	=> array('UINT', 0),
						'user_css'	=> array('MTEXT', ''),
					),
					'PRIMARY_KEY'	=> 'user_id',
				),
			),
			array('phpbb_misc_block', array(
					'COLUMNS' => array(
						'user_id'				=> array('UINT', 0),
						'bbcode_bitfield'		=> array('VCHAR:255', ''),
						'bbcode_uid'			=> array('VCHAR:8', ''),
						'bbcode_options'		=> array('VCHAR:255', ''),
						'enable_bbcode'			=> array('TINT:1', 1),
						'enable_smilies'		=> array('TINT:1', 1),
						'enable_magic_url'		=> array('TINT:1', 1),
						'profile_info_block'	=> array('MTEXT', ''),
					),
					'PRIMARY_KEY'	=> 'user_id',
				),
			),
		),

		'table_row_insert' => array(
			array('phpbb_sn_blocks', array(
				array(
					'block_id'			=> 1,
					'block_name'		=> 'User Info',
					'block_pos'			=> 'L',
					'block_html_file'	=> 'profile_user.html',
					'block_php_file'	=> '',
					'paginate_file'		=> '',
				),
				array(
					'block_id'			=> 2,
					'block_name'		=> 'User Stats',
					'block_pos'			=> 'R',
					'block_html_file'	=> 'profile_stats.html',
					'block_php_file'	=> '',
					'paginate_file'		=> '',
				),
				array(
					'block_id'			=> 3,
					'block_name'		=> 'Example',
					'block_pos'			=> 'C',
					'block_html_file'	=> 'profile_example.html',
					'block_php_file'	=> 'example',
					'paginate_file'		=> '',
				),
				array(
					'block_id'			=> 4,
					'block_name'		=> 'Friends List',
					'block_pos'			=> 'R',
					'block_html_file'	=> 'profile_friends.html',
					'block_php_file'	=> 'friends',
					'paginate_file'		=> 'friends',
				),
				array(
					'block_id'			=> 5,
					'block_name'		=> 'Comments',
					'block_pos'			=> 'C',
					'block_html_file'	=> 'profile_comments.html',
					'block_php_file'	=> 'comments',
					'paginate_file'		=> 'comments',
				),
				array(
					'block_id'			=> 6,
					'block_name'		=> 'Misc',
					'block_pos'			=> 'C',
					'block_html_file'	=> 'profile_misc.html',
					'block_php_file'	=> 'misc',
					'paginate_file'		=> '',
				),
			)),
		),

		'table_column_add' => array(
			array(USERS_TABLE, 'allow_all_comment', array('INT:', 1)),
			array(USERS_TABLE, 'allow_friend_only', array('INT:', 0)),
			array(USERS_TABLE, 'allow_friend_view', array('INT:', 0)),
			array(USERS_TABLE, 'allow_comment_email', array('INT:', 0)),
			array(USERS_TABLE, 'user_last_comment', array('INT:', 0)),
			array(ZEBRA_TABLE, 'message', array('TEXT', '')),
			array(ZEBRA_TABLE, 'block', array('TINT:1', 0)),
			array(USERS_TABLE, 'requests', array('UINT', 0)),
			array(ZEBRA_TABLE, 'req_friends', array('TINT:1', 0)),
			array(USERS_TABLE, 'user_club_id', array('UINT', 0)),
			array(USERS_TABLE, 'only_friends_view', array('TINT:1', 0)),
		),

		'config_add' => array(
			array('simple_comment_enable', true),
			array('comm_per_page', 20),
			array('enable_qc', 1),
			array('enable_comment', 1),
			array('sc_av_size', 50),
			array('number_friends', 50),
			array('friend_avatar_size', 50),
		),

		'cache_purge' => '',
	),

	'0.0.2' => array(
		'table_column_add' => array(
			array(USERS_TABLE, 'profile_settings', array('MTEXT', '')),
			array(USERS_TABLE, 'user_mood', array('UINT', 0)),
		),
	),
);

// Include the UMIF Auto file and everything else will be handled automatically.
include($phpbb_root_path . 'umil/umil_auto.' . $phpEx);

?>